package com.itqf.controller;

import com.itqf.service.DtsRoleService;
import com.itqf.util.ResponseUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * projectName: store_parent
 *
 * @author: 赵伟风
 * time: 2021/6/10 10:48
 * description:
 */
@RestController
@CrossOrigin("*")
@RequestMapping("/admin/role")
public class DtsRoleController {

    private Logger logger = LoggerFactory.getLogger(DtsRoleController.class);

    @Autowired
    private DtsRoleService roleService;

    @RequiresAuthentication
    @GetMapping("options")
    public Object options() {

        logger.info("[角色查询] 开始调用！");
        List<Map<String, String>> data = roleService.findRoles();

        Object ok = ResponseUtil.ok(data);

        logger.info("[角色查询] 结束调用！查询数据为：{}", ok);

        return ok;
    }
}
